const express = require('express')

// service
const { baseUpload, bigFileCutUpload, mergeBigFile, verifyBigFile } = require('./service/upload-service.js')


const router = express.Router()


// 基于流的文件上传
router.post('/api/base/upload/:filename', baseUpload)

// 大文件-切片上传
router.post('/api/big-file/cut-upload/:filename', bigFileCutUpload)

// 大文件-分片合并
router.get('/api/big-file/merge/:filename', mergeBigFile)


// 大文件-验证文件是否存在
router.get('/api/big-file/verify/:filename', verifyBigFile)

router.get('/', (req, res) => {
  res.json({
    code: 1
  })
})



module.exports = (app) => {
  app.use(router)
}